export function getWechatCode() {
	return new Promise((resolve,reject) => {
		uni.login({
			provider: "weixin",
			success: (res) => {
				console.log("login=>",res)
				resolve(res.code)
			},
		})
	})
}

export function getWechatBaseInfo() {
	return new Promise((resolve,reject) => {
		uni.getUserProfile({
			desc: "获取用户基本资料",
			success: res => {
				let user = {
					wxName: "",
					avatar: ""
				};
				user.wxName = res.userInfo.nickName;
				user.avatar = res.userInfo.avatarUrl;
				uni.setStorageSync("user", user);
				console.log("getUserProfile=>",res)
				resolve()
			},
			fail: res => {
				reject()
			}
		})
	})
}
